<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
{eval $user=$this->user; $setting=$this->setting;}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tipask's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset={TIPASK_CHARSET}">
<link media="all" type="text/css" href="css/common/admin/admincp.css" rel="stylesheet"/>
<script src="js/admin.js" type="text/javascript"></script>
<script type="text/javascript">
function checkform(){
	var title=document.askform.title.value;
	if(''==title){
		alert('请填写调用名称!');
		return false;
	}
	return true;
}
</script>
</head>
<body>

<div class="container">
	<!--{if isset($message)}-->
		<!--{eval $type=isset($type)?$type:'correctmsg'; }-->
		<div class="{$type}"><p>{$message}</p></div>
	<!--{/if}-->
	<div class="mainbox nomargin">
		<form name="askform" action="index.php?admin_datacall/edit{$setting['seo_suffix']}" method="post" onsubmit="return checkform();">
		<table class="opt">
				<tr valign="top">
					<td class="f14" nowrap width="110">调用名称:</td>
					<td><input name="title"  id="title" value="{$datacall['title']}"></td>
				</tr>
				<tr valign="top">
					<td colspan="2">
							问题所在分类名: <a href="###"  onclick="insertunit('[category_name]');">[category_name]</a> 
							问题所在分类id: <a href="###"  onclick="insertunit('[category_name]');">[cid]</a><br>
							问题标题: <a href="###"  onclick="insertunit('[category_name]');">[title]</a> 
							问题id:  <a href="###"  onclick="insertunit('[category_name]');">[qid]</a><br>
							悬赏分:  <a href="###"  onclick="insertunit('[category_name]');">[price]</a><br>
							提问者: <a href="###"  onclick="insertunit('[category_name]');">[author]</a> 
							提问者uid: <a href="###"  onclick="insertunit('[category_name]');">[authorid]</a><br>
							提问时间: <a href="###"  onclick="insertunit('[category_name]');">[time]</a><br>
							回答数: <a href="###"  onclick="insertunit('[category_name]');">[answers]</a> 
							顶数: <a href="###"  onclick="insertunit('[category_name]');">[goods]</a><br>
							问题状态: <a href="###"  onclick="insertunit('[category_name]');">[status]</a>
				   </td>
				</tr>
				<tr valign="top">
					<td colspan="2"><textarea  id="tpl_textarea" name="tpl"  style="height:100px;width:800px;"> {$tpl} </textarea></td>
				</tr>
		 
				<tr valign="top">
					<td class="f14" nowrap width="110">状态:</td>
					<td>
						<select name="status" >
						{loop $status_list $st}
						<option value="{$st[0]}" {if $expressionarr['status'] == $st[0]}selected{/if}>{$st[1]}</option>
						{/loop}
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">分类:</td>
					<td class="f14"><span id="classid">
					<table cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td>
								<select id="ClassLevel1" style="WIDTH: 125px" size="8" name="classlevel1">
									<option selected></option>
								</select>
							</td>
							<td width="20">
								<div align="center"><b>→</b></div>
							</td>
							<td>
								<select id="ClassLevel2" style="WIDTH: 125px" size="8" name="classlevel2">
									<option selected></option>
								</select>
							</td>
							<td width="20">
								<div id="jiantou" align="center"><b>→</b></div>
							</td>
							<td>
								<select id="ClassLevel3" style="WIDTH: 125px" onchange="getCidValue();" size="8" name="classlevel3">
									<option selected></option>
								</select>
							</td>
						</tr>
				</table></span></td>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">起始数据行数:</td>
					<td><input name="start"  value="{$expressionarr['start']}" ></td>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">显示数据条数:</td>
					<td><input name="limit"  value="{$expressionarr['limit']}" ></td>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">标题最大字节数:</td>
					<td><input name="maxbyte"  value="{$expressionarr['maxbyte']}" ></td>
				</tr>
				<tr valign="top">
					<td class="f14" nowrap width="110">数据缓存时间(秒):</td>
					<td><input name="cachelife" value="{$expressionarr['cachelife']}"   ></td>
				</tr>
				<tr>
					<td class="f14" width="110">&nbsp;</td>
					<td valign="top">
						<input type="hidden" value="0" name="cid">
						<input type="hidden" value="{$datacall['id']}" name="id">
						<input class="btn" type="submit" value="&nbsp;提交&nbsp;" name="submit">
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
<script type="text/javascript">
	var sortobj=eval('($category_js)');
	var g_ClassLevel1;
	var g_ClassLevel2;
	var g_ClassLevel3;
	var class_level_1=sortobj.category1;
	var class_level_2=sortobj.category2;
	var class_level_3=sortobj.category3;
	var button_noselect="不选择";

function getCidValue()
{
	var _cl1 = document.askform.ClassLevel1;
	var _cl2 = document.askform.ClassLevel2;
	var _cl3 = document.askform.ClassLevel3;
	var _cid = document.askform.cid;
	if(_cl1.value!=0) _cid.value = _cl1.value;
	if(_cl2.value!=0) _cid.value = _cl2.value;
	if(_cl3.value!=0) _cid.value = _cl3.value;
}
function FillClassLevel1(ClassLevel1)
{
    ClassLevel1.options[0] = new Option("aa", "0");
    var selectindex = 0;
    for(i=0; i<class_level_1.length; i++)
    {
        ClassLevel1.options[i] = new Option(class_level_1[i][1], class_level_1[i][0]);
        if(class_level_1[i][0] == {$cid1}){
        	selectindex = i;
        }
        
    }
    ClassLevel1.options[selectindex].selected = true;
    ClassLevel1.length = i;
}
function FillClassLevel2(ClassLevel2, class_level_1_id)
{
    ClassLevel2.options[0] = new Option(button_noselect, "");
    count = 1;
    var selectindex = 0;
    for(i=0; i<class_level_2.length; i++){
    if(class_level_2[i][0].toString() == class_level_1_id) {
	        ClassLevel2.options[count] = new Option(class_level_2[i][2], class_level_2[i][1]);
	        if(class_level_2[i][1] == {$cid2}){
	        	selectindex = count;
	        }
	        count = count+1;    
      }
    }
    ClassLevel2.options[selectindex].selected = true;
    ClassLevel2.length = count;
}
function FillClassLevel3(ClassLevel3, class_level_2_id)
{
    ClassLevel3.options[0] = new Option(button_noselect, "");
    count = 1;
    var selectindex = 0;
    for(i=0; i<class_level_3.length; i++) {
        if(class_level_3[i][0].toString() == class_level_2_id) {
            ClassLevel3.options[count] = new Option(class_level_3[i][2], class_level_3[i][1]);
	        if(class_level_3[i][1] == {$cid3}){
	        	selectindex = count;
	        }
            count = count+1;
         }
    }
    ClassLevel3.options[selectindex].selected = true;
    ClassLevel3.length = count;       
}
function ClassLevel2_onchange()
{
    getCidValue();
    FillClassLevel3(g_ClassLevel3, g_ClassLevel2.value); 
    if (g_ClassLevel3.length <= 1) {  
     g_ClassLevel3.style.display = "none";
	 document.getElementById("jiantou").style.display = "none";
    }
    else {
     g_ClassLevel3.style.display = "";     
	 document.getElementById("jiantou").style.display = "";	 
    }       
}
 
function ClassLevel1_onchange()
{
    getCidValue();
    FillClassLevel2(g_ClassLevel2, g_ClassLevel1.value);
    ClassLevel2_onchange();
	
}
function InitClassLevelList(ClassLevel1, ClassLevel2, ClassLevel3)
{
    g_ClassLevel1=ClassLevel1;
    g_ClassLevel2=ClassLevel2;
    g_ClassLevel3=ClassLevel3;
    g_ClassLevel1.onchange = Function("ClassLevel1_onchange();");
    g_ClassLevel2.onchange = Function("ClassLevel2_onchange();");
    FillClassLevel1(g_ClassLevel1);
    ClassLevel1_onchange();
}
InitClassLevelList(document.askform.ClassLevel1, document.askform.ClassLevel2, document.askform.ClassLevel3);

var selected_id_list="0"
var blank_pos = selected_id_list.indexOf(" ");
var find_blank = true;
if (blank_pos == -1) {
    find_blank = false;
    blank_pos = selected_id_list.length;
}
var id_str = selected_id_list.substr(0, blank_pos);
g_ClassLevel1.value = id_str;
ClassLevel1_onchange();

if (find_blank == true) {
    selected_id_list = selected_id_list.substr(blank_pos + 1,   selected_id_list.length - blank_pos - 1);
    blank_pos = selected_id_list.indexOf(" ");
    if (blank_pos == -1) {
        find_blank = false;
        blank_pos = selected_id_list.length;
    }
    id_str = selected_id_list.substr(0, blank_pos);
    g_ClassLevel2.value = id_str;
    ClassLevel2_onchange();

    if (find_blank == true) {
        selected_id_list = selected_id_list.substr(blank_pos + 1,  selected_id_list.length - blank_pos - 1);
        blank_pos = selected_id_list.indexOf(" ");
        if (blank_pos == -1) {
            find_blank = false;
            blank_pos = selected_id_list.length;
        }
        id_str = selected_id_list.substr(0, blank_pos);
        g_ClassLevel3.value = id_str;
    }
}		
</script>
</body>

</html>
